home *** CD-ROM | disk | FTP | other *** search
- //***********************************************************************
- //
- // MainFrame.cpp
- //
- //***********************************************************************
-
- #include <afxwin.h>
- #include <afxext.h>
- #include "Resource.h"
- #include "StyleBar.h"
- #include "MainFrame.h"
-
- IMPLEMENT_DYNCREATE (CMainFrame, CFrameWnd)
-
- BEGIN_MESSAGE_MAP (CMainFrame, CFrameWnd)
- ON_WM_CREATE ()
- ON_COMMAND_EX (ID_VIEW_STYLE_BAR, OnBarCheck)
- ON_UPDATE_COMMAND_UI (ID_VIEW_STYLE_BAR, OnUpdateControlBarMenu)
- ON_WM_CLOSE ()
- END_MESSAGE_MAP ()
-
- int CMainFrame::OnCreate (LPCREATESTRUCT lpcs)
- {
- if (CFrameWnd::OnCreate (lpcs) == -1)
- return -1;
-
- EnableDocking (CBRS_ALIGN_ANY);
-
- if (!CreateToolBar () ||
- !CreateStyleBar () ||
- !CreateStatusBar ())
- return -1;
-
- LoadBarState ("BarSettings");
- return 0;
- }
-
- void CMainFrame::OnClose ()
- {
- SaveBarState ("BarSettings");
- CFrameWnd::OnClose ();
- }
-
- BOOL CMainFrame::CreateToolBar ()
- {
- if (!m_wndToolBar.Create (this) ||
- !m_wndToolBar.LoadToolBar (IDR_TOOLBAR))
- return FALSE;
-
- m_wndToolBar.SetBarStyle (m_wndToolBar.GetBarStyle () |
- CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
-
- m_wndToolBar.SetWindowText ("Main");
- m_wndToolBar.EnableDocking (CBRS_ALIGN_ANY);
- DockControlBar (&m_wndToolBar);
- return TRUE;
- }
-
- BOOL CMainFrame::CreateStyleBar ()
- {
- if (!m_wndStyleBar.Create (this, WS_CHILD | WS_VISIBLE | CBRS_TOP |
- CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, IDW_STYLE_BAR))
- return FALSE;
-
- m_wndStyleBar.SetWindowText ("Styles");
- m_wndStyleBar.EnableDocking (CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
- DockControlBar (&m_wndStyleBar);
- return TRUE;
- }
-
- BOOL CMainFrame::CreateStatusBar ()
- {
- static UINT nIndicators[] = {
- ID_SEPARATOR,
- ID_INDICATOR_LINE,
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM
- };
-
- if (!m_wndStatusBar.Create (this))
- return FALSE;
-
- m_wndStatusBar.SetIndicators (nIndicators, 4);
- return TRUE;
- }
-